package iO;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Author: Miyako
 * @Date: 2024-07-16-11:38
 * @Description: 块复制
 */
public class CopyDemo02 {
    public static void main(String[] args) throws IOException {
        FileInputStream fil = new FileInputStream("13.png");
        FileOutputStream fol = new FileOutputStream("14.png");
        byte[] a = new byte[1024];
        int b;
        b = fil.read(a);//每次读1024，不足的则作为结束值
        while (b != -1) {
            fol.write(a, 0, b);//a：一次读多少 off：从哪里开始读 b：读到多少结束
            b = fil.read(a);
        }
        fil.close();
        fol.close();
    }
}

